Cette ligne retourne une liste des modes de paiement internes à BP.
lst_modes = [BP.OperationGetNameFromModeIndex(i) for i in range( int(BP.GetURL('mode_count')))]
Résultat :
['Carte', 'Retrait DAB', 'Ch\xe8que \xe9mis', 'Pr\xe9l\xe8vement', 'Virement \xe9mis', 'TIP', 'Versement', 'D\xe9p\xf4t de ch\xe8que', 'Virement re\xe7u', 'Titre']
import BP g_categ_name_none = "[ Aucune ]" def indented_categ_name(cnames, i): parent = BP.CategParent[i] if parent == i: return cnames[i] else: return " %s" %cnames[i] def complete_categ_name(cnames, i): parent = BP.CategParent[i] if parent == i: return cnames[i] else: return "%s > %s" %(cnames[parent], cnames[i]) cnames = BP.CategName; icnames = [indented_categ_name(cnames, i) for i in range(len(cnames))] ccnames = [complete_categ_name(cnames, i) for i in range(len(cnames))] print icnames print ccnames
import BP none = "- Aucune -" CPrt = BP.CategParent cnames = BP.CategName CTrimNames = [] CPositions = {-1: -1} CIndexes = {-1: -1} CNames = [] for i, c in enumerate(cnames): p = c.find("=") CNames.append(c[p+1:]) CTrimNames.append(c[p+1:].strip()) idx = int(c[:p]) CPositions[idx] = i CIndexes[i] = idx icnames = "\n".join([none] + CNames) ccnames = [none] + [ ("%s > %s" %(CTrimNames[CPrt[i]], c), c)[CPrt[i] == i] for i, c in enumerate(CTrimNames)] print icnames print ccnames
Cf. https://www.chelly.net/punbb/viewtopic.php?pid=5444#p5444
def BankPerfectVersion(strCheminExecutableBP): strVersion = "FileVersion" fichier = open(strCheminExecutableBP, "rb") listeLignes = fichier.readlines() intNumeroLigne = len(listeLignes) - 1 boolTrouve = False strLigne = "" intIndexDebut = -1 while (intNumeroLigne >= 0) and (not boolTrouve): strLigne = listeLignes[intNumeroLigne].replace("\x00", "") intIndexDebut = strLigne.find(strVersion) if (intIndexDebut!=-1): boolTrouve = True intNumeroLigne -= 1 if (boolTrouve): intIndexFin = strLigne.find("8\x0C\x01", intIndexDebut) if (intIndexFin!=-1): return strLigne[(intIndexDebut + len(strVersion)): intIndexFin] return -1 fichier.close()